package com.yc.ioc.bean4_ioc_import;

import com.yc.ioc.bean4_ioc_import.other.WaterMelon;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author zwei
 * @create 2024-07-29 8:47
 */
public class App2_importSelector {
    public static void main(String[] args) {
        ApplicationContext ac=new AnnotationConfigApplicationContext(AppConfig_2.class);
        //获取容器中所有的bean定义
        String[] beanNames = ac.getBeanDefinitionNames();
        for (String beanName : beanNames) {
            System.out.println(beanName);
        }
        WaterMelon wm= (WaterMelon) ac.getBean("com.yc.bean4_ioc_import.other.WaterMelon");
        System.out.println(wm);
    }
}
